1 /**
2 * Copyright 2008 WebPhotos
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.webphotos.entity;
17
18 /**
19 *
20 * @author Guilherme
21 */
22 public abstract class PhotoEntity implements IsPhoto {
23
24 @Override
25 public int compareTo(IsPhoto o2) {
26 return this.getKey().compareTo(o2.getKey());
27 }
28
29 @Override
30 public int hashCode() {
31 return this.getKey().hashCode();
32 }
33
34 @Override
35 public boolean equals(Object obj) {
36 if (obj == null) {
37 return false;
38 }
39 if (getClass() != obj.getClass()) {
40 return false;
41 }
42 final PhotoEntity other = (PhotoEntity) obj;
43
44 return this.getKey().equals(other.getKey());
45 }
46
47 }